#!/bin/bash
echo '创库授权';
mysql -uroot -p123456 -e"
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY '123456';
exit"
echo '2.安装、配置组件';
yum install openstack-keystone httpd mod_wsgi -y;
echo '修改配置文件';
cp /etc/keystone/keystone.conf{,.bak};
grep '^[a-Z\[]' /etc/keystone/keystone.conf.bak > /etc/keystone/keystone.conf;
openstack-config --set /etc/keystone/keystone.conf database connection mysql+pymysql://keystone:123456@controller/keystone;
openstack-config --set /etc/keystone/keystone.conf token provider fernet;
echo '同步数据库';
su -s /bin/sh -c "keystone-manage db_sync" keystone;
echo '数据库初始化';
keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone;
keystone-manage credential_setup --keystone-user keystone --keystone-group keystone;
echo '引导身份认证服务';
keystone-manage bootstrap --bootstrap-password 123456 --bootstrap-admin-url http://controller:35357/v3/ --bootstrap-internal-url http://controller:5000/v3/ --bootstrap-public-url http://controller:5000/v3/ --bootstrap-region-id RegionOne;
echo '-----------------------------------------------------';
echo '                   keystone 配置完成                 ';
echo '-----------------------------------------------------';

